﻿using System.Windows.Controls;
using System.Windows;
using Esponce.Models;
using System.Windows.Input;

namespace Esponce.Views
{
	public partial class TrackImportView : UserControl
	{
		public TrackImportView()
		{
			InitializeComponent();
		}

		public TrackImportViewModel ViewModel
		{
			get
			{
				return this.DataContext as TrackImportViewModel;
			}
		}

		private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			ViewModel.Browse();
			ViewModel.Import();
		}

		private void Border_Drop(object sender, DragEventArgs e)
		{
			var data = e.Data as DataObject;
			if (data != null && data.ContainsFileDropList())
			{
				foreach (string file in data.GetFileDropList())
				{
					ViewModel.FilePath = (file);
					ViewModel.Import();
					break;
				}
			}
		}
	}
}
